import {defineStore} from "pinia"

//第一个参数仓库命名空间，唯一性
//第二个参数仓库的核心内容
export const userStore = defineStore("userStore",{
    state:()=>{
        return {
            username:"xiaowang",
            users:[],
            mode:"en"
        }
    },
    getters:{
        fullName(state){
            const newName = state.username.toUpperCase()
            return newName
        }
    },
    actions:{
        changeUsername(val:string){
            console.log(val);
            
            this.username = val
        },
        async asyncChangeUsername(val:string){
            this.username = val
        }
    }

})